package com.solution.admin.customer.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.solution.admin.customer.entity.CustomerEntity;
import com.solution.admin.customer.service.CustomerService;

/**
 * 客户注册管理控制层
 * @author: solin
 * @date: 2017年10月24日 下午4:49:50
 */
@RequestMapping("/registerMgmt")
@Controller
public class RegisterMgmtController {
	private Logger logger = LoggerFactory.getLogger(RegisterMgmtController.class);
	
	@Autowired
	private CustomerService customerService;
	
	/**
	 * 跳转到客户注册管理页面
	 * @param customer
	 * @param request
	 * @return
	 * @author: solin
	 * @date: 2017年10月24日 下午4:51:53
	 */
	@RequestMapping("/toListCustomerPage")
	public String toListCustomerPage(CustomerEntity customer, HttpServletRequest request) {
		return "customer/register_mgmt_list";
	}
	
	/**
	 * 跳转到审核页面
	 * @param customer
	 * @param request
	 * @return
	 * @author: solin
	 * @date: 2017年10月24日 下午6:53:39
	 */
	@RequestMapping("/toAuditPage")
	public String toAuditPage(CustomerEntity customer, HttpServletRequest request) {
		request.setAttribute("customerId", request.getParameter("customerId"));
		return "customer/register_audit_form";
	}
	
	/**
	 * 跳转到注册信息详情页
	 * @param customer
	 * @param request
	 * @return
	 * @author: solin
	 * @date: 2017年10月30日 下午2:35:52
	 */
	@RequestMapping("/toCustomerDetailPage")
	public String toCustomerDetailPage(Long customerId, HttpServletRequest request) {
		CustomerEntity customer = customerService.getCustomerById(customerId);
		request.setAttribute("customer", customer);
		return "customer/register_customer_info";
	}
}
